package com.vates.vsp.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.DimensionUIResource;

import com.vates.vsp.gui.cliente.VentanaMostrarTodosClientes;
import com.vates.vsp.gui.hotel.VentanaMostrarTodosHoteles;
import com.vates.vsp.gui.reserva.VentanaMostrarTodasReservas;

import javax.swing.UIManager;
import javax.swing.JLabel;

public class VentanaPrincipal extends JFrame {
	private static final long serialVersionUID = 1L;
	
	private JPanel contentPane;

	public VentanaPrincipal() {
		initComponents();	
	}
	
	private void initComponents() {
		setTitle(".:: Proyecto Final - VSP - VATES ::.");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 858, 564);
		contentPane = new JPanel();
		contentPane.setBackground(Color.WHITE);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(0, 0));
		setMinimumSize(new DimensionUIResource(1010, 610));
		
		JToolBar toolBar = new JToolBar();
		toolBar.setBackground(Color.WHITE);
		toolBar.setFloatable(false);
		contentPane.add(toolBar, BorderLayout.NORTH);
		
		JButton btnClientes = new JButton(":::CLIENTES:::");
		btnClientes.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				clientes();
			}
		});
		btnClientes.setForeground(Color.WHITE);
		btnClientes.setBackground(UIManager.getColor("InternalFrame.activeTitleGradient"));
		btnClientes.setFont(new Font("Tahoma", Font.BOLD, 25));
		toolBar.add(btnClientes);
		
		JButton btnHoteles = new JButton(":::HOTELES:::");
		btnHoteles.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				hoteles();
			}
		});
		btnHoteles.setForeground(Color.WHITE);
		btnHoteles.setBackground(UIManager.getColor("InternalFrame.activeTitleGradient"));
		btnHoteles.setFont(new Font("Tahoma", Font.BOLD, 25));
		toolBar.add(btnHoteles);
		
		JButton btnReservas = new JButton(":::RESERVAS:::");
		btnReservas.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				reservas();
			}
		});
		btnReservas.setForeground(Color.WHITE);
		btnReservas.setBackground(UIManager.getColor("InternalFrame.activeTitleGradient"));
		btnReservas.setFont(new Font("Tahoma", Font.BOLD, 25));
		toolBar.add(btnReservas);
		
		JButton btnsalir = new JButton(":::SALIR:::");
		btnsalir.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				salir();
			}
		});
		btnsalir.setForeground(Color.WHITE);
		btnsalir.setBackground(Color.ORANGE);
		btnsalir.setFont(new Font("Tahoma", Font.BOLD, 25));
		toolBar.add(btnsalir);
		
		JLabel lblUInfo = new JLabel("VSP JAVA PRACTICO FINAL - Diego Diambri - Rodrigo Carri\u00F3n - Vates S.A. 2012");
		lblUInfo.setFont(new Font("Tahoma", Font.BOLD, 17));
		contentPane.add(lblUInfo, BorderLayout.SOUTH);
		setExtendedState(MAXIMIZED_BOTH);
	}
	
	private void salir() {
		System.exit(500);
	}
	
	private void clientes() {
		JDialog jd = new VentanaMostrarTodosClientes();
		jd.setVisible(true);
	}
	
	private void hoteles() {
		JDialog jd = new VentanaMostrarTodosHoteles();
		jd.setVisible(true);
	}
	
	private void reservas() {
		JDialog jd = new VentanaMostrarTodasReservas();
		jd.setVisible(true);
	}
}
